<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../../../assets/libs/jquery/jquery-3.6.1.min.js"></script>
</head>

<body>
  <div class="grandparent">
    <div class="parent">
      <div class="origin"></div>
    </div>
  </div>

  <script>
    // 祖先节点
    let jElem = $('.origin').parents('.grandparent')
    console.log(jElem)

    // 父节点
    jElem = $('.origin').parent('.parent')
    console.log(jElem)
  </script>
</body>

</html>